﻿<%@ Page Title="Data Management - News & Comment" Language="C#" MasterPageFile="~/admin.master"
    AutoEventWireup="true" Inherits="MediaMonitor.Admin.Data_Mgmt_NewsAlert" Theme="default"
    CodeBehind="data-mgmt-NewsAlert.aspx.cs" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="Server">
  <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
      <script type="text/javascript">

          function DateSelected(sender, eventArgs) {
              var date = eventArgs.get_renderDay().get_date();
              var dfi = sender.DateTimeFormatInfo;
              var formattedDate = dfi.FormatDate(date, dfi.ShortDatePattern);

              var calE = $find("<%= calE.ClientID %>");

              calE.selectDate(date, true)

          }


          function conformbox() {
              var con = confirm("Are you sure to delete this record?");
              if (con == true) {
                  return true;
              }
              else {
                  return false;
              }
          }

          function conformbox2() {
              var con2 = confirm("Are you sure to delete all the dates?");
              if (con2 == true) {
                  return true;
              }
              else {
                  return false;
              }
          }

          </script>
        <script src="../rad-scripts/rad.js" type="text/javascript"></script>
    </telerik:RadCodeBlock>
   </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="Server">
    <telerik:RadAjaxPanel ID="radPanel" runat="server" RestoreOriginalRenderDelegate="false">

    
   <table border="0" cellpadding="0" cellspacing="0" style="margin-bottom:20px;">
             <tr>
        <td colspan="2">
            <b>Dates</b><br /><br />
        </td>
    </tr>

   
    <tr>
        <td></td>
        <td>
            <table>
                <tr valign="top">
                    <td>
                        From Date
                        <br />
                        <telerik:RadCalendar AutoPostBack="false" ID="calS" runat="server" EnableMultiSelect="false"
                            ClientEvents-OnDateSelected="DateSelected">
                        </telerik:RadCalendar>
                    </td>
                    <td><div style="width:50px;"></div></td>
                    <td>
                        To Date
                        <br />
                        <telerik:RadCalendar AutoPostBack="false" ID="calE" runat="server" EnableMultiSelect="false">
                        </telerik:RadCalendar>
                    </td>
                     <td><div style="width:50px;"></div></td>
                       <td>
                      
                       <asp:LinkButton ID="btnDeleteAll" runat="server" Text=".. Delete .." OnClientClick="return conformbox();" OnClick="btnDeleteAll_Clicked" Font-Size="16" >
                        </asp:LinkButton>
                    </td>
                    
                </tr>
                
                 <tr>
    <td  colspan="2" style="padding-top:20px;">
       <asp:LinkButton ID="btnDeleteEverything" runat="server" Text=".. Delete all the dates .." OnClientClick="return conformbox2();" OnClick="btnDeleteEverything_Clicked" Font-Size="16" >
                        </asp:LinkButton>
    </td>
    </tr>
            </table>
        </td> 
    </tr>
            </table>
    
    <div>
        Click the
        <img src="../App_Themes/default/cssimg/exapand.png" style="display: inline;" />
        link at the left side of records to expand the data.
        <br />
    </div>
    
        <telerik:RadGrid ID="radGrid" runat="server" AllowFilteringByColumn="false" AllowPaging="True"  
            AllowSorting="True" GridLines="None" Skin="Hay" OnNeedDataSource="radGrid_NeedDataSource"
            AutoGenerateColumns="False" PageSize="50" OnDeleteCommand="radGrid_DeleteCommand">
            <MasterTableView DataKeyNames="RFDate" >
                <Columns>
                    <telerik:GridButtonColumn Text="Delete" ButtonType="LinkButton" ConfirmText="Are you sure to delete this record?"
                        ConfirmTitle="Delete Confirmation" CommandName="Delete" ItemStyle-Width="50"  />
                    <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="RFDate" HeaderText="Date"
                        HtmlEncode="false" DataFormatString="{0:d}" ItemStyle-Font-Size="Larger" ItemStyle-BackColor="#575757"
                        ItemStyle-ForeColor="White" ItemStyle-Font-Bold="true"/>
                </Columns>
                <DetailTables>
                    <telerik:GridTableView DataSourceID="sqlDSTraffic" PageSize="15" AllowFilteringByColumn="true"
                        AllowSorting="true" AllowPaging="true" DataKeyNames="ID">
                        <ParentTableRelation>
                            <telerik:GridRelationFields MasterKeyField="RFDate" DetailKeyField="RFDate"  />
                        </ParentTableRelation>
                        <Columns>
                            <telerik:GridButtonColumn Text="Delete" ButtonType="LinkButton" ConfirmText="Are you sure to delete this record?"
                                ConfirmTitle="Delete Confirmation" CommandName="Delete" />
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="RFDate" HeaderText="Date"
                                HtmlEncode="false" DataFormatString="{0:d}" AllowFiltering="false"/>
                           
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="MediaName" HeaderText="Media Name" AllowFiltering="true"/>
                             <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="MediaCode" HeaderText="Media Code" AllowFiltering="true"/>
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="RFDate" DataFormatString="{0:d}" HeaderText="Date" AllowFiltering="true"/>
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="MediaDescription" HeaderText="Media Description" AllowFiltering="true"/>
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="SectionCode" HeaderText="Section Code" AllowFiltering="true"/> 
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="SectionDescription" HeaderText="Section Description" AllowFiltering="true"/>
                           <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="PageorHour" HeaderText="Page or Hour" AllowFiltering="true"/> 
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="Duration" HeaderText="Duration" AllowFiltering="true"/>
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="Advertiser" HeaderText="Advertiser" AllowFiltering="true"/>
                                    <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="Title" HeaderText="Title" AllowFiltering="true"/> 
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="Calification" HeaderText="Calification" AllowFiltering="true"/>
                           <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="Important" HeaderText="Important" AllowFiltering="true"/> 
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="NewsSummary" HeaderText="News Summary" AllowFiltering="true"/>
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="OthersBrandsDnvolved" HeaderText="Others Brands Dnvolved" AllowFiltering="true"/>
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="OthersPeoplesInvolved" HeaderText="Others Peoples Involved" AllowFiltering="true"/> 
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="Link" HeaderText="Link" AllowFiltering="true"/>
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="ImageAudioVideoName" HeaderText="Image/Audio/Video Name" AllowFiltering="true"/>
                            <telerik:GridBoundColumn AutoPostBackOnFilter="true" DataField="News" HeaderText="News" AllowFiltering="true"/>
                        </Columns>
                    </telerik:GridTableView>
                </DetailTables>
            </MasterTableView>
            <ClientSettings>
                <Scrolling AllowScroll="false" />
                <ClientEvents OnFilterMenuShowing="filterMenuShowing" />
            </ClientSettings>
            <FilterMenu OnClientShowing="MenuShowing" />
        </telerik:RadGrid>
    </telerik:RadAjaxPanel>
     <asp:SqlDataSource ID="sqlDSTraffic" runat="server" ConnectionString="<%$ ConnectionStrings:DBAdex %>"
         SelectCommand="SELECT * FROM vNewsAlertLog where RFDate = @RFDate" >
         <SelectParameters>
         <asp:Parameter Name="RFDate" DefaultValue="1/1/2000" Type="String" />
         </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>
